<?php
	DEFINE('H1', 'Remote File Reader');
	DEFINE('TITLE','Remote Filer Reader');
	require('includes/header.php');
?>	
	<h2><?PHP echo H1 ?></h2>
	
<?php
	if (!isset($_POST['submit'])) {
?>

<form method="post" action="remote.php">
<input type="radio" name="site" value="google" />www.google.com<br />
<input type="radio" name="site" value="don" />www.drdongable.com<br />
<input type="radio" name="site" value="local" />myfile.txt<br /><br />
<input type="submit" name="submit" value="Submit" />
</form>

<?php
	} else {
	
	 $selected_radio = $_POST['site'];

	if ($selected_radio == 'google') {
		$file = fopen("http://www.google.com", "r");
		while (!feof($file)) {
			$content = fgets($file);
			print $content . "<br />";
			}	
	fclose($file);
	}
	else if ($selected_radio == 'don') {
		$file2 = fopen("http://www.drdongable.com/adm/logfile.txt", "r");
		while (!feof($file2)) {
			$content2 = fgets($file2);
			print $content2 . "<br />";
			}
	fclose($file2);
	}
	else if ($selected_radio == 'local'){
		$file3 = fopen("adm/myfile.txt", "r");
		while (!feof($file3)) {
			$content3 = fgets($file3);
			print $content3 . "<br />";
			}
		fclose($file3);
		}					
}
?>
<?php
	require('includes/footer.php');
?>